	Ext.BLANK_IMAGE_URL = "../script/ext-2.0.2/resources/images/default/s.gif"; 
	
	var storePasswordManage = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url: 'passwordAdmin!getList.action?dateTime='+new Date().getTime()}),
        reader: new Ext.data.JsonReader({
            root: 'ZANY',
            totalProperty: "results",
            fields:["userName","userCode","roleName","userOrg"]
        }),
        remoteSort: true
    }); 
    
    storePasswordManage.load();
    
    var orgTreeLoader = new Ext.tree.TreeLoader({dataUrl:'../util/orgTree!getAllTree.action?dateTime='+new Date().getTime()});
    
    var orgTree = new Ext.ux.ComboBoxTree({
			name:'orgId1',
			hiddenName:'orgId1',
			fieldLabel: '机构',
			resizable:true,
			width :200,
			height:300,
			tree : {
				xtype:'treepanel',
				loader: orgTreeLoader,
	       	 	root : new Ext.tree.AsyncTreeNode({id:'0',draggable:false,text:'机构树'})
	    	},
	    	emptyText:'请选择机构...',
			selectNodeModel:'exceptRoot'
		});	
		
    var userNameTemp = new Ext.form.TextField({ 
		id:'userNameTemp',
		name:'userNameTemp',
		width:100
		});
	
	var sm = new Ext.grid.CheckboxSelectionModel();
	
	var colPasswordManage=new Ext.grid.ColumnModel([sm,
		{header:"用户名",dataIndex:"userName",width:10,sortable:true},
		{header:"用户ID",dataIndex:"userCode",width:10,sortable:true},
		{header:"角色",dataIndex:"roleName",width:10,sortable:true},
		{header:"机构",dataIndex:"userOrg",width:10,sortable:true}
		]);
		
	var passwordManage = new Ext.grid.GridPanel({
		id:'passwordManage',
		title :'[用户管理]信息维护',
		height:500,
		stripeRows :true,
		bodyStyle:'width:100%',
        disableSelection:true,
		cm: colPasswordManage,
		viewConfig: {
            forceFit:true
        },
		store: storePasswordManage,
		iconCls: 'details',
		animCollapse: true,
		trackMouseOver:false, 
        loadMask: {msg:'正在加载[用户管理]信息，请稍侯……'},
		selModel:sm, 
		tbar:['-',new Ext.form.Label({text:'姓名:'}),'-',userNameTemp,
		      '-',new Ext.form.Label({text:'所属机构：'}),'-',orgTree,
			  '-',{pressed:true,text:'&nbsp;&nbsp;查&nbsp;&nbsp;&nbsp;&nbsp;询&nbsp;&nbsp;&nbsp;&nbsp;',iconCls:'yes',handler:getList},
			  '-',{text:'重&nbsp;&nbsp置',iconCls:'refresh',handler:resetQuery}
		],
		buttons:[
				 {pressed:true,text:'重置密码',iconCls:'add',handler:update}
		],
		bbar: new Ext.PagingToolbar({
	            pageSize: 20,
	            store: storePasswordManage,
	            displayInfo: true,
	        	emptyMsg:'没有记录'
	        })
	});
	
	function resetQuery(){
		Ext.getCmp("userNameTemp").setValue('');
		orgTree.setValue('');
	}
	
	function update(){
		if (Ext.getCmp("passwordManage").getSelectionModel().hasSelection()) {
			Ext.MessageBox.confirm('Message','请问您真的要重置密码？',function(btn){
        	if(btn == 'yes'){	
	            var ids = new Array();
	            var records = Ext.getCmp("passwordManage").getSelectionModel().getSelections();
	            for (var i = 0, len = records.length; i < len; i++) {
	                ids[i] = records[i].data["userCode"];
	            }
	            Ext.Ajax.request({url:'passwordAdmin!update.action?dateTime='+new Date().getTime(),
	                params:{updateId:ids},
	                success:function(response, options){
	                   var response = Ext.util.JSON.decode(response.responseText);
						if(response.success){
	                    	ZANY.util.Msg('信息',"重置密码成功！");
						}else if(!response.success){
							ZANY.util.Msg('信息',"重置密码失败，如有问题请联系系统管理员！");  
						}             
	                }
	        	});
			}
		})}else{
			ZANY.util.Msg('提示信息',"请选择用户后再操作！");   
		}
	}
	
	function getList(){
		var params={};
	    params.userName = Ext.get('userNameTemp').getValue();
	    params.orgId = orgTree.getValue();
	    storePasswordManage.baseParams=params;
	    storePasswordManage.load({
	    	callback : function(r, options, success) {   
		        if (success == false) {   
		            Ext.Msg.alert("错误", storePasswordManage.reader.jsonData.msg);
		        }   
		    }
		});
	}
	
	Ext.onReady(function(){
		Ext.QuickTips.init(); 
	　　 Ext.form.Field.prototype.msgTarget = 'side';
			var port = new Ext.Viewport({
				layout : 'fit',
				frame : true,
				items : [this.passwordManage]
	    	});
	});